package com.example.tms.mapper;

import com.example.tms.bean.ErrorInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 报错
 */
@Repository
public interface ErrorMapper extends JpaRepository<ErrorInfo,String>, JpaSpecificationExecutor<ErrorInfo> {

    //报错审核
    @Query(value = "update error_info set shjg = ?2, shr = ?3, shrq = ?4 where bcid = ?1", nativeQuery = true)
    @Modifying
    @Transactional
    void bcsh(String bcid, String shjg, String shr, String shrq);

    //报错信息查询
    List<ErrorInfo> findAllByYdhOrderByCjsjDesc(String ydh);

}
